<template>
	<div class="count-apps">
		<div class="card">
			<div class="card__header">
				<span class="label"><router-link to="/app/release">应用总数</router-link></span>
				<span class="value">{{ totalReleaseApps }}</span>
			</div>

			<div class="card__container">
				<el-progress :percentage="50" :stroke-width="8"></el-progress>
			</div>

			<div class="card__footer">
				<ul class="count-apps__cop">
					<li>
						<span><router-link to="/app/audit">待审核</router-link></span>

						<div class="fall">
							<span>{{ totalAuditApps }}</span>
						</div>
					</li>

					<li>
						<span>开发中</span>

						<div class="rise">
							<span>{{ totalIsDevApps }}</span>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</div>
</template>

<script>
export default {
	created() {
		this.showTotalReleaseApps();
		this.showTotalAuditApps();
		this.showTotalIsDevApps();
	},

	data() {
		return {
			totalReleaseApps: 0,
			totalAuditApps: 0,
			totalIsDevApps: 0
		};
	},

	methods: {
		showTotalReleaseApps() {
			this.$service.common.countReleaseApp().then((res) => {
				this.totalReleaseApps = res;
			});
		},

		showTotalAuditApps() {
			this.$service.common.countAuditApp().then((res) => {
				this.totalAuditApps = res;
			});
		},

		showTotalIsDevApps() {
			this.$service.common.countIsDevApp().then((res) => {
				this.totalIsDevApps = res;
			});
		}
	}
};
</script>

<style lang="scss" scoped>
@import "./common.scss";

.count-apps {
	&__cop {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 100%;

		li {
			display: flex;
			list-style: none;
			flex: 1;

			.fall,
			.rise {
				display: flex;
				align-items: center;
				margin-left: 10px;
			}
		}
	}

	.card__container {
		padding-top: 15px;
		padding-right: 10px;
		box-sizing: border-box;
	}
}
</style>
